package com.hope;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

public class TutorialFragment extends Fragment {
	private final String ARG_OBJECT = "tutorial_object";
	private final int GETTING_STARTED = 0;
	private final int ADD_PILL = 1;
	private final int VIEW_PILL = 2;
	private final int VIEW_CALENDAR = 3;
	private final int CHECK_INVENTORY = 4;
	private final int EMERGENCY = 5;
	private final int SETTINGS = 6;
	
	public TutorialFragment() {
		
	}
    
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.tutorial_object, container, false);
        TextView title = (TextView) rootView.findViewById(R.id.tutorial_title);
        TextView description = (TextView) rootView.findViewById(R.id.tutorial_description);
        ImageView image = (ImageView) rootView.findViewById(R.id.tutorial_image);
        
        Bundle args = getArguments();
        String title_name = "tutorial_title" + getAddition(args.getInt(ARG_OBJECT));
        String desc_name = "tutorial_desc" + getAddition(args.getInt(ARG_OBJECT));
        title.setText(getString(getActivity().getBaseContext().getResources().getIdentifier(title_name, "string", "com.hope")));
        description.setText(getString(getActivity().getBaseContext().getResources().getIdentifier(desc_name, "string", "com.hope")));
        image.setImageResource(R.drawable.tutorial_image_getting_started);
        
        return rootView;
    }
    
    public String getArgObject() {
    	return ARG_OBJECT;
    }
    
    private String getAddition(int id) {
    	switch (id) {
	    	case GETTING_STARTED: return "_getting_started";
	    	case ADD_PILL: return "_add_pill";
	    	case VIEW_PILL: return "_view_pill";
	    	case VIEW_CALENDAR: return "_calendar";
	    	case CHECK_INVENTORY: return "_inventory";
	    	case EMERGENCY: return "_emergency";
	    	case SETTINGS: return "_settings";
    	}
    	return "";
    }
}
